/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon
 												
Class							:				UnitAtSoftCondition
 
Function						: 				Provides a class for holding a 
												condition that specifies Unit 
												at a particular location	
****************************************************************************/

package planninglanguage.softconditions;

import base.WargusGameState;
import base.WargusUnit;


public class UnitAtSoftCondition extends SoftCondition {

	int m_unitID;
	int m_x;
	int m_y;
	public UnitAtSoftCondition(int a_unitID,int a_x,int a_y)
	{
		m_unitID=a_unitID;
		m_x=a_x;
		m_y=a_y;
		
	}
	public String toString(int tabs)
	{
		String n = super.toString(tabs);
		n = n + "Unit Id is" + m_unitID + "\n";
		n = n + "X coordinate is" + m_x + "\n";
		n = n + "Y coordinate is" + m_y + "\n";
		
		return n;

	}
	public float test(WargusGameState a_gameState)
	{
		WargusUnit u = a_gameState.getUnit(m_unitID);

		if (u!=null && u.getLocX()==m_x && u.getLocY()==m_y) return 1.0f;
		return 0.0f;
	}
	
}
